----------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/nicholasweller/Dropbox/Weller Files/Networks/BugsVsGods/JEPS/JEPS_replication.lo
> g
  log type:  text
 opened on:  15 Nov 2018, 13:28:00

. do "/var/folders/ks/tkncx3zn18d29237jb0wczfh0000gn/T//SD10627.000000"

. 
. clear 

. set more off

. 
. 
. /*Place this .do file and JEPSreplication.dta in the same folder and 
> change the working directory to that folder */
. 
. 
. /*This data file has network statistics already computed. To replicate go to
> JEPS Network Stats.do and follow the instructions.*/
. 
. use JEPSreplication.dta

. 
. //convert miliseconds to seconds
. gen timetaken_secs=timetaken/1000

. 
. 
. /*Initial comparison of effect of information view on time to coordinate */
. 
. ttest timetaken_secs, by(infoviewnum)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
       0 |     119    106.9248    6.006206    65.51997    95.03088    118.8187
       1 |     328     64.5734    3.454249    62.55911    57.77804    71.36875
---------+--------------------------------------------------------------------
combined |     447    75.84816    3.121824    66.00278    69.71284    81.98347
---------+--------------------------------------------------------------------
    diff |            42.35141    6.780206                29.02621    55.67661
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t =   6.2463
Ho: diff = 0                                     degrees of freedom =      445

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 1.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 0.0000

. prtest success, by(infoviewnum)

Two-sample test of proportions                     0: Number of obs =      119
                                                   1: Number of obs =      328
------------------------------------------------------------------------------
       Group |       Mean   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           0 |   .6470588   .0438076                      .5611975    .7329202
           1 |   .8414634   .0201672                      .8019364    .8809904
-------------+----------------------------------------------------------------
        diff |  -.1944046   .0482268                     -.2889273   -.0998818
             |  under Ho:   .0436101    -4.46   0.000
------------------------------------------------------------------------------
        diff = prop(0) - prop(1)                                  z =  -4.4578
    Ho: diff = 0

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(Z < z) = 0.0000         Pr(|Z| > |z|) = 0.0000          Pr(Z > z) = 1.0000

. 
. 
. //Table 2
. sort network

. by network: ttest timetaken_secs, by(infoview)

----------------------------------------------------------------------------------------------------
-> network = 2leaderDIS

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
     low |      17    120.6987    16.14568    66.57033     86.4714     154.926
     med |      63    69.00114    8.159481    64.76387    52.69057    85.31171
---------+--------------------------------------------------------------------
combined |      80    79.98688    7.617601    68.13389    64.82442    95.14933
---------+--------------------------------------------------------------------
    diff |            51.69756    17.80279                16.25493     87.1402
------------------------------------------------------------------------------
    diff = mean(low) - mean(med)                                  t =   2.9039
Ho: diff = 0                                     degrees of freedom =       78

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9976         Pr(|T| > |t|) = 0.0048          Pr(T > t) = 0.0024

----------------------------------------------------------------------------------------------------
-> network = 2leaders

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
     low |      27    119.4424    12.22048     63.4995     94.3228    144.5619
     med |      67    54.81318    7.005506    57.34254    40.82624    68.80012
---------+--------------------------------------------------------------------
combined |      94    73.37688    6.783237    65.76592    59.90672    86.84705
---------+--------------------------------------------------------------------
    diff |            64.62919    13.48284                 37.8511    91.40728
------------------------------------------------------------------------------
    diff = mean(low) - mean(med)                                  t =   4.7934
Ho: diff = 0                                     degrees of freedom =       92

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 1.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 0.0000

----------------------------------------------------------------------------------------------------
-> network = mixture

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
     low |      26    73.18327    12.41593    63.30909    47.61217    98.75436
     med |      61    42.66421    6.714038    52.43831    29.23414    56.09429
---------+--------------------------------------------------------------------
combined |      87    51.78485    6.141075    57.28013     39.5768     63.9929
---------+--------------------------------------------------------------------
    diff |            30.51906    13.08203                4.508473    56.52964
------------------------------------------------------------------------------
    diff = mean(low) - mean(med)                                  t =   2.3329
Ho: diff = 0                                     degrees of freedom =       85

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9890         Pr(|T| > |t|) = 0.0220          Pr(T > t) = 0.0110

----------------------------------------------------------------------------------------------------
-> network = noleader

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
     low |      24    119.7708    12.18764    59.70697    94.55875    144.9828
     med |      67    96.11182    8.431279      69.013    79.27823    112.9454
---------+--------------------------------------------------------------------
combined |      91    102.3515    7.042766     67.1837    88.35987    116.3432
---------+--------------------------------------------------------------------
    diff |            23.65897    15.87506               -7.884431    55.20237
------------------------------------------------------------------------------
    diff = mean(low) - mean(med)                                  t =   1.4903
Ho: diff = 0                                     degrees of freedom =       89

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9302         Pr(|T| > |t|) = 0.1397          Pr(T > t) = 0.0698

----------------------------------------------------------------------------------------------------
-> network = star

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
     low |      25    106.7986    13.39178    66.95892    79.15936    134.4379
     med |      70    58.83586    6.710747    56.14614    45.44828    72.22343
---------+--------------------------------------------------------------------
combined |      95    71.45764     6.41505    62.52617    58.72041    84.19487
---------+--------------------------------------------------------------------
    diff |            47.96278    13.77597                20.60643    75.31914
------------------------------------------------------------------------------
    diff = mean(low) - mean(med)                                  t =   3.4816
Ho: diff = 0                                     degrees of freedom =       93

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9996         Pr(|T| > |t|) = 0.0008          Pr(T > t) = 0.0004

. 
. /*Figure 2: 
> Graph showing degree variance and coordination time across network 
> knowledge; mixture network is excluded because it has many more edges than the
> other networks and therefore is not a good comparison */
. 
. /* create mean_timetaken by network for Figure 2 */
. 
. sort network infoviewnum 

. 
. by network infoviewnum: egen mean_timetaken=mean(timetaken_secs)

.    
. twoway (connected mean_timetaken d_centralization if infoviewnum==0 & ///
> network~="mixture", sort xsc(r(01)) ysc(range(0 140)) ylabel(0(20)140)) (connected mean_timetaken 
> d_centralization ///
> if infoviewnum==1& network~="mixture", sort xsc(r(01)) ysc(range(0 140))), ///
>  legend(order(1 "Low Information" 2 "Medium Information")) scheme (plottig)

.  
. 
. 
. /* Table 3: Analysis using Tobit regression in which the data are panel data with a panel
> consisting of a group of trials and the time consisting of the order within the 
> group of trials. */
. 
. xtset newdate trialid
       panel variable:  newdate (unbalanced)
        time variable:  trialid, 1 to 56, but with gaps
                delta:  1 unit

. 
. //regression to test three predictions
. xttobit timetaken_secs edges infoviewnum##c.d_centralization i.newdate trialid, ul(180)
note: 17.newdate omitted because of collinearity

Fitting comparison model:

Fitting constant-only model:

Iteration 0:   log likelihood =  -2178.131  
Iteration 1:   log likelihood = -2161.0062  
Iteration 2:   log likelihood = -2160.8384  
Iteration 3:   log likelihood = -2160.8384  

Fitting full model:

Iteration 0:   log likelihood = -2091.6054  
Iteration 1:   log likelihood = -2074.9481  
Iteration 2:   log likelihood = -2074.8648  
Iteration 3:   log likelihood = -2074.8648  

Obtaining starting values for full model:

Iteration 0:   log likelihood = -2417.6388
Iteration 1:   log likelihood = -2417.4091
Iteration 2:   log likelihood = -2417.4082

Fitting full model:

Iteration 0:   log likelihood = -2094.7804  
Iteration 1:   log likelihood = -2075.2049  
Iteration 2:   log likelihood = -2074.8654  
Iteration 3:   log likelihood = -2074.8648  
Iteration 4:   log likelihood = -2074.8648  

Random-effects tobit regression                 Number of obs     =        447
                                                   Uncensored     =        353
Limits: lower = -inf                               Left-censored  =          0
        upper = 180                                Right-censored =         94

Group variable: newdate                         Number of groups  =         16
Random effects u_i ~ Gaussian                   Obs per group:
                                                              min =          7
                                                              avg =       27.9
                                                              max =         56

Integration method: mvaghermite                 Integration pts.  =         12

                                                Wald chi2(19)     =     194.63
Log likelihood  = -2074.8648                    Prob > chi2       =     0.0000

------------------------------------------------------------------------------------------------
                timetaken_secs |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------------------+----------------------------------------------------------------
                         edges |  -1.758433   .2907264    -6.05   0.000    -2.328246    -1.18862
                 1.infoviewnum |  -87.95997   21.00452    -4.19   0.000    -129.1281   -46.79186
              d_centralization |  -23.48725   18.66102    -1.26   0.208    -60.06218    13.08768
                               |
infoviewnum#c.d_centralization |
                            1  |  -37.57122   19.65323    -1.91   0.056    -76.09085    .9484066
                               |
                       newdate |
                   11/28/12_2  |  -46.99653   22.07718    -2.13   0.033    -90.26702   -3.726045
                     11/29/12  |  -.4521561   21.74932    -0.02   0.983    -43.08003    42.17572
                      2/16/11  |   65.93996   20.32139     3.24   0.001     26.11077    105.7692
                      2/23/11  |    121.299   21.09168     5.75   0.000      79.9601     162.638
                      2/24/11  |   55.62471   17.49327     3.18   0.001     21.33852    89.91089
                      3/24/11  |  -14.70525   15.46165    -0.95   0.342    -45.00953    15.59903
                      4/15/13  |  -57.06722   19.71214    -2.90   0.004    -95.70231   -18.43213
                      4/27/11  |  -21.52722   15.20401    -1.42   0.157    -51.32653    8.272099
                      4/30/13  |   -37.3442   21.90244    -1.71   0.088     -80.2722    5.583795
                    5/25/11.1  |    53.6371   19.51902     2.75   0.006     15.38051    91.89368
                    5/25/11.2  |   28.21445   17.31915     1.63   0.103    -5.730468    62.15936
                    5/25/11.3  |  -35.21303   13.81602    -2.55   0.011    -62.29193   -8.134135
                      7/14/10  |   13.21668   28.38408     0.47   0.641    -42.41508    68.84845
                    10/5/11.1  |  -10.59217   15.54456    -0.68   0.496    -41.05895     19.8746
                  10/5/2011.2  |          0  (omitted)
                               |
                       trialid |   1.022513   .3128706     3.27   0.001     .4092976    1.635728
                         _cons |   196.8155   20.51571     9.59   0.000     156.6055    237.0256
-------------------------------+----------------------------------------------------------------
                      /sigma_u |   3.57e-16   3.201257     0.00   1.000    -6.274348    6.274348
                      /sigma_e |    66.0058   2.635592    25.04   0.000     60.84014    71.17147
-------------------------------+----------------------------------------------------------------
                           rho |   2.93e-35   5.25e-19                             0           1
------------------------------------------------------------------------------------------------
LR test of sigma_u=0: chibar2(01) = 0.00               Prob >= chibar2 = 1.000


. outreg2 using Table3, stats(coef se pval) word excel replace ///
> title("Table 3: Network Structure, Knowledge and Coordination Time") 
Table3.rtf
Table3.xml
dir : seeout

. 
. /*Test combined effect of centralization in the medium information condition 
> requires looking at both main effect of centralization and its interaction
> with the Medium Info condition */
. 
. test _b[timetaken_secs:d_centralization] + _b[timetaken_secs:1.infoviewnum#c.d_centralization]==0

 ( 1)  [timetaken_secs]d_centralization + [timetaken_secs]1.infoviewnum#c.d_centralization = 0

           chi2(  1) =   24.75
         Prob > chi2 =    0.0000

. 
. 
. 
. /* Regression to test three predictions using success as outcome; discussed in 
> footnote XX */
. xtlogit success edges infoviewnum##c.degreevariance i.newdate trialid
note: 15.newdate != 0 predicts success perfectly
      15.newdate dropped and 7 obs not used

note: 17.newdate omitted because of collinearity

Fitting comparison model:

Iteration 0:   log likelihood = -228.24335  
Iteration 1:   log likelihood = -180.91922  
Iteration 2:   log likelihood = -173.20986  
Iteration 3:   log likelihood = -172.98386  
Iteration 4:   log likelihood = -172.98372  
Iteration 5:   log likelihood = -172.98372  

Fitting full model:

tau =  0.0     log likelihood = -172.98372
tau =  0.1     log likelihood = -175.53027

Iteration 0:   log likelihood = -175.53027  
Iteration 1:   log likelihood = -173.00895  
Iteration 2:   log likelihood = -172.98471  
Iteration 3:   log likelihood = -172.98377  
Iteration 4:   log likelihood = -172.98372  
Iteration 5:   log likelihood = -172.98372  

Random-effects logistic regression              Number of obs     =        440
Group variable: newdate                         Number of groups  =         15

Random effects u_i ~ Gaussian                   Obs per group:
                                                              min =         18
                                                              avg =       29.3
                                                              max =         56

Integration method: mvaghermite                 Integration pts.  =         12

                                                Wald chi2(18)     =      68.31
Log likelihood  = -172.98372                    Prob > chi2       =     0.0000

----------------------------------------------------------------------------------------------
                     success |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-----------------------------+----------------------------------------------------------------
                       edges |   .0563953   .0135858     4.15   0.000     .0297677     .083023
               1.infoviewnum |   2.413885   .8069754     2.99   0.003     .8322427    3.995528
              degreevariance |   .0470358   .0522904     0.90   0.368    -.0554515    .1495231
                             |
infoviewnum#c.degreevariance |
                          1  |   .2148189   .0723612     2.97   0.003     .0729936    .3566443
                             |
                     newdate |
                 11/28/12_2  |   .9350742   .7023042     1.33   0.183    -.4414167    2.311565
                   11/29/12  |   .4338657   .6561866     0.66   0.508    -.8522364    1.719968
                    2/16/11  |   -1.60076   .8606553    -1.86   0.063    -3.287614    .0860931
                    2/23/11  |  -3.691196   .8287739    -4.45   0.000    -5.315563   -2.066828
                    2/24/11  |  -2.029852    .720192    -2.82   0.005    -3.441403   -.6183016
                    3/24/11  |   .6834234   .8949903     0.76   0.445    -1.070725    2.437572
                    4/15/13  |    1.85469   .6611811     2.81   0.005     .5587986    3.150581
                    4/27/11  |   .8062401   .8902399     0.91   0.365     -.938598    2.551078
                    4/30/13  |   .6710525   .6720027     1.00   0.318    -.6460486    1.988154
                  5/25/11.1  |  -2.211479   .8118862    -2.72   0.006    -3.802747   -.6202112
                  5/25/11.2  |  -1.574355   .7334999    -2.15   0.032    -3.011988   -.1367213
                  5/25/11.3  |   1.274683   .7765474     1.64   0.101    -.2473217    2.796688
                    7/14/10  |          0  (empty)
                  10/5/11.1  |   1.008239   .8845217     1.14   0.254    -.7253915     2.74187
                10/5/2011.2  |          0  (omitted)
                             |
                     trialid |   -.051957   .0165943    -3.13   0.002    -.0844812   -.0194327
                       _cons |  -1.237003    .700795    -1.77   0.078    -2.610536    .1365295
-----------------------------+----------------------------------------------------------------
                    /lnsig2u |   -16.6219    48.1506                     -110.9953    77.75154
-----------------------------+----------------------------------------------------------------
                     sigma_u |   .0002458    .005918                      7.90e-25    7.65e+16
                         rho |   1.84e-08   8.84e-07                      1.90e-49           1
----------------------------------------------------------------------------------------------
LR test of rho=0: chibar2(01) = 0.00                   Prob >= chibar2 = 1.000

. 
. /*Test if the total effect of degree centralzation in Med info conditionn is 
> different than 0 */
. test _b[success:degreevariance] + _b[success:1.infoviewnum#c.degreevariance]==0

 ( 1)  [success]degreevariance + [success]1.infoviewnum#c.degreevariance = 0

           chi2(  1) =   18.87
         Prob > chi2 =    0.0000

. 
. 
. //Comparison of Star vs. No Leader
. //Low Information
.   ttest timetaken_secs if infoviewnum==0 & (network=="noleader" | network=="star"), by(network)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
noleader |      24    119.7708    12.18764    59.70697    94.55875    144.9828
    star |      25    106.7986    13.39178    66.95892    79.15936    134.4379
---------+--------------------------------------------------------------------
combined |      49    113.1523    9.027021    63.18915    95.00231    131.3024
---------+--------------------------------------------------------------------
    diff |            12.97215    18.15053               -23.54201    49.48631
------------------------------------------------------------------------------
    diff = mean(noleader) - mean(star)                            t =   0.7147
Ho: diff = 0                                     degrees of freedom =       47

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.7608         Pr(|T| > |t|) = 0.4783          Pr(T > t) = 0.2392

.   
. //Medium Information
.   ttest timetaken_secs if infoviewnum==1 & (network=="noleader" | network=="star"), by(network)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
noleader |      67    96.11182    8.431279      69.013    79.27823    112.9454
    star |      70    58.83586    6.710747    56.14614    45.44828    72.22343
---------+--------------------------------------------------------------------
combined |     137    77.06571      5.5766    65.27243    66.03764    88.09377
---------+--------------------------------------------------------------------
    diff |            37.27596    10.72767                16.05994    58.49199
------------------------------------------------------------------------------
    diff = mean(noleader) - mean(star)                            t =   3.4748
Ho: diff = 0                                     degrees of freedom =      135

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9997         Pr(|T| > |t|) = 0.0007          Pr(T > t) = 0.0003

.   
. //comparison No Leader and Star, across info conditions
.   ttest timetaken_secs if network=="noleader", by(infoviewnum)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
       0 |      24    119.7708    12.18764    59.70697    94.55875    144.9828
       1 |      67    96.11182    8.431279      69.013    79.27823    112.9454
---------+--------------------------------------------------------------------
combined |      91    102.3515    7.042766     67.1837    88.35987    116.3432
---------+--------------------------------------------------------------------
    diff |            23.65897    15.87506               -7.884431    55.20237
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t =   1.4903
Ho: diff = 0                                     degrees of freedom =       89

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9302         Pr(|T| > |t|) = 0.1397          Pr(T > t) = 0.0698

.   ttest timetaken_secs if network=="star", by(infoviewnum)

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
       0 |      25    106.7986    13.39178    66.95892    79.15936    134.4379
       1 |      70    58.83586    6.710747    56.14614    45.44828    72.22343
---------+--------------------------------------------------------------------
combined |      95    71.45764     6.41505    62.52617    58.72041    84.19487
---------+--------------------------------------------------------------------
    diff |            47.96278    13.77597                20.60643    75.31914
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t =   3.4816
Ho: diff = 0                                     degrees of freedom =       93

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.9996         Pr(|T| > |t|) = 0.0008          Pr(T > t) = 0.0004

.   
.    
.   clear

.   
.   
.   
. 
end of do-file

. log close
      name:  <unnamed>
       log:  /Users/nicholasweller/Dropbox/Weller Files/Networks/BugsVsGods/JEPS/JEPS_replication.lo
> g
  log type:  text
 closed on:  15 Nov 2018, 13:28:24
----------------------------------------------------------------------------------------------------
